using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace PresentationManager
{
    /// <summary>
    /// Represents a windows form of Algs Editor
    /// </summary>
    public partial class FormAlgsEditor : Form
    {
        /// <summary>
        /// Gets or sets the demo information.
        /// </summary>
        /// <value>The demo information.</value>
        public DemoInfo DemoInfo
        {
            get
            {
                DemoInfo result = new DemoInfo();
                result.Path = txtPath.Text;
                result.Name = txtName.Text;
                result.Description = txtDescription.Text;
                return result;
            }
            set
            {
                txtPath.Text = value.Path;
                txtName.Text = value.Name;
                txtDescription.Text = value.Description;
            }
        }

        /// <summary>
        /// Disables the path.
        /// </summary>
        public void DisablePath()
        {
            this.txtPath.Enabled = false;
            this.btnBrowse.Enabled = false;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="FormAlgsEditor"/> class.
        /// </summary>
        public FormAlgsEditor()
        {
            InitializeComponent();
        }

        /// <summary>
        /// Handles the Click event of the btnBrowse control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void btnBrowse_Click(object sender, EventArgs e)
        {
            openFileDialog1.FileName = string.Empty;
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
                txtPath.Text = openFileDialog1.FileName;
        }
    }
}